package es.aa.android.cartomatic.appview;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AbsListView.MultiChoiceModeListener;
import android.widget.GridView;
import es.aa.android.cartomatic.R;
import es.aa.android.cartomatic.appview.adapter.CardAdapter;
import es.aa.android.cartomatic.customview.mSimpleList;
import es.aa.android.cartomatic.implementations.da.SQLiteAccess;
import es.aa.android.cartomatic.interfaces.da.ISQLiteAccess;

public class CardsSelectionView extends FragmentActivity {
	
	private ISQLiteAccess sqLiteAcces;
	private mSimpleList listCards;
	private CardAdapter adapterCards;
	
	@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cards_selection);
        
        init();
        
    }

	private void init() {
		
		sqLiteAcces = new SQLiteAccess();
		
		listCards = (mSimpleList) findViewById(R.id.listCards);
		listCards.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
		listCards.setMultiChoiceListener(new MultiChoiceModeListener() {
			
			@Override
			public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
				// TODO Auto-generated method stub
				return false;
			}
			
			@Override
			public void onDestroyActionMode(ActionMode mode) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public boolean onCreateActionMode(ActionMode mode, Menu menu) {
				// TODO Auto-generated method stub
				return false;
			}
			
			@Override
			public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
				// TODO Auto-generated method stub
				return false;
			}
			
			@Override
			public void onItemCheckedStateChanged(ActionMode mode, int position,
					long id, boolean checked) {
				// TODO Auto-generated method stub
				
			}
		});
		
		adapterCards = new CardAdapter(this, sqLiteAcces.readCardLibrary(this));
		
	}

}
